package com.ruoyi.manage.service.impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.manage.service.IAppDictDataService;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: wwy
 * @Date: 2021/1/27 13:05
 */
@Service
public class AppDictDataServiceImpl implements IAppDictDataService {
    @Override
    public AjaxResult getCarTypeAll() {
        List<Map<String,Object>> listMap = new ArrayList<>();
        List<SysDictData> car_typeList = DictUtils.getDictCache("car_type");
        for (SysDictData sysDictData : car_typeList) {
            Map<String,Object> map = new HashMap<>();
            String dictLabel = sysDictData.getDictLabel();
            String dicValue = sysDictData.getDictValue();
            map.put("id",Integer.parseInt(dicValue));
            map.put("text",dictLabel);
            listMap.add(map);
        }
        return AjaxResult.success(listMap);
    }
}
